0%

Introduction to Time Series Analysis - 03

Introduction to Time Series Analysis - 03

This note is for course MATH 545 at McGill University.

Lecture 7 - Lecture 9


Test for weak stationarity
  1. sample autocorrelation (for white noise only)

    problem: so many hh's

  2. portmanteau test

    Q=j=1hρ^2(j)Q = \sum^h_{j=1}\hat{\rho}^2(j)

    If yt iid N(0,σ2)y_{t} \stackrel{\text { iid }}{\sim} N(0, \sigma^{2}), then Qχh2Q \sim \chi^2_h

    QLB=n(n+2)j=1hρ^2(j)njQ_{LB}=n(n+2)\sum^h_{j=1}\frac{\hat{\rho}^2(j)}{n-j}

  3. Turing points test

    yiy_i is a turing point if yi<yi1,yi<yi+1y_i < y_{i-1}, y_i<y_{i+1} or yi>yi1,yi>yi+1y_i > y_{i-1}, y_i>y_{i+1}

    Let yiy_i be a turing point. For iid sequences, let TT be the size of turing points.

    What’s the probability of turing point after tt? ANS: 2/3

    So E(T)=(n2)23E(T)=(n-2)\frac{2}{3}, ν(T)=16n2990\nu(T)=\frac{16n-29}{90}

    TE(T)ν(T)N(0,1)\frac{T-E(T)}{\sqrt{\nu(T)}} \sim N(0, 1) for large nn

  4. sign test: count yi+1yi>0y_{i+1} - y_i >0

    Exact signal hypothesis test for H0:p=0.5H_0: p=0.5

  5. Rank tests (compare ranks of yty_t with tt)

(Note: there may be 20 minutes note that I did not take)

Prediction: m(Xn)=E(Xn+hXn)m(X_n)=E(X_{n+h}|X_n)

Show that E(Xn+hXn)E(X_{n+h}|X_n) is the unique minimizer of E[(Xn+hm(Xn))2]E[(X_{n+h}-m(X_n))^2].

Assume m^(Xn)\hat{m}(X_n) minimizes E[(Xn+hm(Xn))2]E[(X_{n+h}-m(X_n))^2], then E[(Xn+hm^(Xn))2]E[(X_{n+h}-\hat{m}(X_n))^2] is the minimum value of MSE.

E[(Xn+hm^(Xn))2]=E[(Xn+1E(Xn+hXn)+E(Xn+hXn)m^(Xn))2]=E[(Xn+hE(Xn+hXn))2]+2E[(Xn+hE(Xn+hXn))(E(Xn+hXn)m^(Xn))]+E[E(Xn+hXn)m^(Xn))2]E[(X_{n+h}-\hat{m}(X_n))^2]\\=E\left[\left(X_{n+1}-E\left(X_{n+h} | X_{n}\right)+E\left(X_{n+h} | X_{n}\right)-\hat{m}\left(X_{n}\right)\right)^{2}\right]\\=\left.E\left[\left(X_{n+h}-E\left(X_{n+h} | X_{n}\right)\right)^{2}\right]+2 E\left[\left(X_{n+h}-E\left(X_{n+h}\right| X_{n}\right)\right)\left(E\left(X_{n+h} | X_{n}\right)-\hat{m}\left(X_{n}\right)\right)\right]+\left.E\left[E\left(X_{n+h} | X_{n}\right)-\hat{m}\left(X_{n}\right)\right)^{2}\right]

Focus on the second term:

2E[(Xn+hE(Xn+hXn))(E(Xn+hXn)m^(Xn))]=2EXnEXn+hXn[(Xn+hE(Xn+hXn))(E(Xn+hXn)m^(Xn))Xn]=2Exn[(E(Xn+hXn)m(Xn))]EXn+hXn[(Xn+hE(Xn+hXn))]=02E[(X_{n+h}-E(X_{n+h}| X_{n}))(E(X_{n+h} | X_{n})-\hat{m}(X_{n}))]\\=2 E_{X_{n}} E_{X_{n+h} | X_{n}}\left[\left(X_{n+h}-E\left(X_{n+h} | X_{n}\right)\right)\left(E\left(X_{n+h} | X_{n}\right)-\hat{m}\left(X_{n}\right)\right) | X_{n}\right]\\=2 E_{x_{n}}\left[\left(E\left(X_{n+h} | X_{n}\right)-m\left(X_{n}\right)\right)\right] E_{X_{n+h} | X_{n}}\left[\left(X_{n+h}-E\left(X_{n+h} | X_{n}\right)\right)\right]\\=0

So E[(Xn+hm^(Xn))2]=E[(Xn+hE(Xn+hXn))2]+E[E(Xn+hXn)m^(Xn))2]E[(X_{n+h}-\hat{m}(X_n))^2]=\left.E\left[\left(X_{n+h}-E\left(X_{n+h} | X_{n}\right)\right)^{2}\right]+E[E\left(X_{n+h} | X_{n}\right)-\hat{m}\left(X_{n}\right)\right)^{2}]

and this equation is greater than 0 unless E(Xn+hXn)=m^(Xn)E\left(X_{n+h} | X_{n}\right)=\hat{m}\left(X_{n}\right) and then this equation equal to 0.

But this obviously extends to conditioning on (X1,X2,...,Xn)(X_1, X_2, ..., X_n)

Choose a model for E(Xn+hXn)E(X_{n+h}|X_n) and we always start from linear

What is the best linear predictor for Xn+hX_{n+h} that is a function of XnX_n?

E[(Xn+h(a+bXn))2]=E(Xn+h2)2E[Xn+h(a+bXn)]+E[(a+bXn)2]=E(Xn+12)2(aE(Xn+h)+bE(Xn+hXn))+a2+2abE(Xn)+b2E(Xn2)\begin{array}{l}{\quad E\left[\left(X_{n+h}-\left(a+b X_{n}\right)\right)^{2}\right]} \\ {=E\left(X_{n+h}^{2}\right)-2 E\left[X_{n+h}\left(a+b X_{n}\right)\right]+E\left[\left(a+b X_{n}\right)^{2}\right]} \\ {=E\left(X_{n+1}^{2}\right)-2\left(a E\left(X_{n+h}\right)+b E\left(X_{n+h} X_{n}\right)\right)+a^{2}+2 ab E\left(X_{n}\right)+b^{2} E\left(X_{n}^{2}\right)}\end{array}

We take the derivative

a=2E(Xn+h)+2a+2bE(Xn)\frac{\partial}{\partial a}=-2 E\left(X_{n+h}\right)+2 a+2 b E\left(X_{n}\right)

b=2E(Xn+hXn)+2aE(Xn)+2bE(Xn2)\frac{\partial}{\partial b}=-2 E\left(X_{n+h} X_{n}\right)+2 a E\left(X_{n}\right)+2 b E\left(X_{n}^{2}\right)

Set two derivatives equal to 0, we have

a^=E(Xn+h)b^E(Xn)=μ(n+h)b^μ(n)\hat{a}=E\left(X_{n+h}\right)-\hat{b} E\left(X_{n}\right)=\mu(n+h)-\hat{b}\mu(n)

Adding the equation above to this equation: E(Xn+hXn)+a^E(Xn)+b^E(Xn2)=0-E\left(X_{n+h} X_{n}\right)+\hat{a} E\left(X_{n}\right)+\hat{b} E\left(X_{n}^{2}\right)=0

We have:

E(Xn+nXn)+(μ(n+h)b^μ(n))E(Xn)+b^E(Xn2)=0-E\left(X_{n+n} X_{n}\right)+(\mu(n+h)-\hat{b} \mu(n)) E\left(X_{n}\right)+\hat{b} E\left(X_{n}^{2}\right)=0

and thus b^=E(Xn+hXn)μ(n+h)μ(n)E(Xn2)(μ(n))2=Cov(Xn+h,Xn)Var(Xn)\hat{b}=\frac{E\left(X_{n+h} X_{n}\right)-\mu(n+h) \mu(n)}{E\left(X_{n}^{2}\right)-(\mu(n))^{2}}=\frac{\operatorname{Cov}\left(X_{n+h}, X_{n}\right)}{\operatorname{Var}\left(X_{n}\right)}

So a^=μ(n+h)cov(Xn+h,Xn)Var(Xn)μ(n)\hat{a}=\mu(n+h)-\frac{\operatorname{cov}\left(X_{n+h}, X_{n}\right)}{\operatorname{Var}\left(X_{n}\right)} \mu(n)

and X^n+h=a^+b^Xn=μ(n+h)+Cov(Xn+h,Xn)Var(Xn)(Xnμ(n))\hat{X}_{n+h}=\hat{a}+\hat{b} X_{n}=\mu(n+h)+\frac{\operatorname{Cov}\left(X_{n+h}, X_{n}\right)}{\operatorname{Var}\left(X_{n}\right)}\left(X_{n}-\mu(n)\right)

If {Xt}\{X_t\} is stationary, then X^n+h=μ+γ(h)γ(0)(Xnμ)=ρ(h)Xn+(1ρ(h))μ\hat{X}_{n+h}=\mu+\frac{\gamma(h)}{\gamma(0)}\left(X_{n}-\mu\right)=\rho(h) X_{n}+(1-\rho(h))\mu

Properties of γ(h)\gamma(h)
  1. γ(0)=0\gamma(0)=0 (variance)
  2. γ(h)γ(0)|\gamma(h)| \leq \gamma(0) (Cauchy-Schwarz inequality: <u,v>2u,uvv|<u, v>|^{2} \leq\langle u, u\rangle \cdot\langle v \cdot v\rangle)
  3. γ(h)\gamma(h) is even: γ(h)=γ(h)\gamma(h)=\gamma(-h)
  4. γ(h)\gamma(h) is non-negative definite: i=1nj=1naiγ(ij)aj0nZ+,aRn\sum_{i=1}^{n} \sum_{j=1}^{n} a_{i} \gamma(i-j) a_{j} \geqslant 0 \quad \forall n \in Z^{+}, \quad a \in R^{n}

Even stronger property: let γ(h)\gamma(h) be a function defined on hZh \in Z, γ(h)\gamma(h) is non-negative and even \Leftrightarrow It is the auto-covariance function of some stationary sequence

Strictly stationary series

Def. {Xt}\{X_t\} is strictly stationary if (x1,,xn)=d(x1+n1,,xn+1)n and n\left(x_{1}, \ldots, x_{n}\right) \stackrel{d}{=} \left(x_{1}+n_{1}, \ldots, x_{n+1}\right) \quad \forall n \text { and } n

Properties

  1. all elements of {Xt}\{X_t\} are identically distributed
  2. (Xt,Xt+h)=d(X1,X1+h)(X_t, X_{t+h}) \stackrel{d}{=} (X_1, X_{1+h})
  3. If E(Xt2)<E(X_t^2) < \infty, then {Xt}\{X_t\} is weakly stationary
  4. weakly stationary does not imply strictly stationary
  5. IID process is strictly stationary
How to make a stationary sequence?

Let {Zt}\{Z_t\} be an iid sequence of random variables.

Let Xt=g(Zt,Zt1,...,Ztq)X_t=g(Z_t, Z_{t-1}, ..., Z_{t-q}), then XtX_t us strictly stationary, because (zt+h,,zt+hq)=d(zt,,ztq)\left(z_{t+h}, \ldots, z_{t+h-q}\right) \stackrel{d}{=}\left(z_{t}, \ldots, z_{t-q}\right)

This sequence {Xt}\{X_t\} is q-dependent, i.e. XtX_t and XsX_s are independent if ts>q|t-s|>q

Generalize to weakly stationary, say that {Xt}\{X_t\} is q-correlated if Cov(Xt,Xs)=0ts>q or γ(h)=0h>q\operatorname{Cov}\left(X_{t}, X_{s}\right)=0 \quad \forall|t-s|>q \text { or } \gamma(h)=0 \quad \forall|h|>q

Every second order weakly stationary process is either a linear process or can be transformed into one by substracting a deterministic component.

Def. {Xt}\{X_t\} is a linear process if Xt=j=ψjZtjX_{t}=\sum_{j=-\infty}^{\infty} \psi_{j}-Z_{t-j} where {Zt}WN(0,σ2)\{Z_t\}\sim WN(0, \sigma^2) and {ψj}\{\psi_{j}\} is a sequence of where j=ψj<\sum_{j=-\infty}^{\infty}\left|\psi_{j}\right|<\infty

We can view {Xt}\{X_t\} in terms of Backwards shift operator Xt=ψ(B)ZtX_t=\psi(B)Z_t where ψ(B)=j=ψjBj\psi(B)=\sum^\infty_{j=-\infty}\psi_jB^j. (Example: Moving average process has this property)

E[Xt]E[j=Ztjψj]j=ψjE[Ztj]j=ψjE[Ztj2]1/2E[|X_t|] \leq E[\sum^\infty_{j=-\infty}|Z_{t-j}\psi_j|] \\ \leq \sum^\infty_{j=-\infty}|\psi_j|E[|Z_{t-j}|] \leq \sum^\infty_{j=-\infty}|\psi_j|E[|Z_{t-j}|^2]^{1/2}

Let {Yt}\{Y_t\} be stationary process with mean 0 and auto-covariance function γY(h)\gamma_Y(h). If j=ψj<\sum^\infty_{j=-\infty}|\psi_j| < \infty, then for Xt=j=ψjYtj=ψ(B)YtX_t = \sum^\infty_{j=-\infty}\psi_j Y_{t-j}=\psi(B)Y_t, XtX_t is also a stationary sequence with mean 0 and auto-cvovatiance funciton γX(h)=j=k=ψjψkγY(h+kj)\gamma_X(h)=\sum^\infty_{j=-\infty}\sum^\infty_{k=-\infty} \psi_j \psi_k \gamma_Y(h+k-j) where Yt=j=ψjZtjY_t = \sum^\infty_{j=-\infty} \psi_j Z_{t-j} and {Zt}\{Z_t\} is a White Noise process.

Proof. (There is a little difference in the notation of kk and jj because of different definition)

γX(h)=E[XtXth]=E[(k=ψkytk)(j=ψjytjh)]=E[j=k=ψkψj(ytk)(ytjh)]=j=k=ψkψjγY(h+jk)\gamma_X(h) = E[X_t X_{t-h}] \\=E\left[\left(\sum_{k=-\infty}^{\infty} \psi_{k} y_{t-k}\right)\left(\sum_{j=-\infty}^{\infty} \psi_{j} y_{t-j-h}\right)\right] \\=E\left[\sum_{j=-\infty}^{\infty} \sum_{k=-\infty}^{\infty} \psi_{k} \psi_{j}\left(y_{t-k}\right)\left(y_{t-j-h}\right)\right] \\=\sum_{j=-\infty}^{\infty} \sum_{k=-\infty}^{\infty} \psi_{k} \psi_{j} \gamma_{Y}(h+j-k)

If {Yt}\{Y_t\} is WN(0,σ2)WN(0, \sigma^2) process, then γY(l)=0,l0\gamma_Y(l)=0, \forall l\neq 0 \Rightarrow γX(h)=j=ψjψjhσ2\gamma_X(h)=\sum_{j=-\infty}^{\infty} \psi_j\psi_{j-h} \sigma^{2}

Example: AR(1) process

For {Xt}\{X_t\} stationary, let Xt=ϕXt1ZtX_t=\phi X_{t-1}Z_t where {Zt}WN(0,σ2)\{Z_t\} \sim WN(0, \sigma^2). {Xt}\{X_t\} and {Zs}\{Z_s\} are uncorrelated for s>ts>t

Define {Xt}\{X_t\} to be the solution to XtϕXt1=ZtX_t - \phi X_{t-1} = Z_t

Consider Xt=j=0ϕjZtjX_t=\sum^\infty_{j=0}\phi^jZ_{t-j}, we have that {Xt}\{X_t\} is linear with ψj=ϕjforj0\psi_j=\phi^j \quad \text{for} j \geq 0, and ψj=0forj<0\psi_j=0 \quad \text{for} j < 0.

And j=ψj<\sum^\infty_{j=-\infty}|\psi_j| < \infty iff ϕ<1|\phi| < 1

To solve XtϕXt1=ZtX_{t}-\phi X_{t-1}=Z_t:

[j=0ϕjZtj]ϕ[j=0ϕjZt1j]=Zt\left[\sum_{j=0}^{\infty} \phi^{j} Z_{t-j}\right]-\phi\left[\sum_{j=0}^{\infty} \phi^{j} Z_{t-1-j}\right] = Z_{t}

[j=0ϕjZtj][j=0ϕj+1Zt(j+1)]=Zt\left[\sum_{j=0}^{\infty} \phi^{j} Z_{t-j}\right]-\left[\sum_{j=0}^{\infty} \phi^{j+1} Z_{t-(j+1)}\right] = Z_{t}

[j=0ϕjZtj][j=1ϕjZtj]=Zt\left[\sum_{j=0}^{\infty} \phi^{j} Z_{t-j}\right]-\left[\sum_{j=1}^{\infty} \phi^{j} Z_{t-j}\right] = Z_{t}

Zt=ZtZ_t=Z_t

Therefore, {Zt}\{Z_t\} is stationary \Rightarrow {Xt}\{X_t\} is stationary with mean 0 and auto-covariance function γX(h)=j=0ϕjϕj+hσ2=σ2ϕh1ϕ2\gamma_X(h)=\sum_{j=0}^{\infty} \phi^j\phi^{j+h} \sigma^{2}=\frac{\sigma^2 \phi^h}{1-\phi^2}

If ϕ>1|\phi| > 1, then no stationary sequence exists that dependent on the past

Let Φ(B)=1ϕB\Phi(B)=1-\phi B and Π(B)=j=0ψjBj\Pi(B)=\sum^\infty_{j=0}\psi^jB^j

Then ψ(B)=Φ(B)Π(B)=(1ϕB)(j=0ψjBj)=j=0ψjBjj=0ψj+1Bj+1=ψ0B0=1\psi(B)=\Phi(B)\Pi(B)\\=(1-\phi B)(\sum^\infty_{j=0}\psi^jB^j)\\=\sum^\infty_{j=0}\psi^jB^j - \sum^\infty_{j=0}\psi^{j+1}B^{j+1}\\=\psi^0B^0=1

XtϕXt1=(1ϕB)Xt=Φ(B)XtX_t-\phi X_{t-1} = (1-\phi B)X_t=\Phi(B)X_t

Π(B)Φ(B)Xt=Π(B)Zt\Pi(B)\Phi(B)X_t=\Pi(B)Z_t

ψ(B)Xt=Π(B)Zt\psi(B)X_t=\Pi(B)Z_t

Xt=j=0ϕjBjZt=j=0ϕjZtjX_t = \sum^\infty_{j=0}\phi^jB_jZ_t = \sum^\infty_{j=0}\phi^jZ_{t-j}